"use client"; import { getCommissionApi, getRegisterCountApi, getTotalCountApi, getWithdrawalApi, UserAgentToDayInfo, UserCommissionStatistics, } from "@/api/summary"; import { useUserInfoStore } from "@/stores/useUserInfoStore"; import { useRequest } from "ahooks"; import { Toast } from "antd-mobile"; import { useLocale, useTranslations } from "next-intl"; import { getToken } from "@/utils/Cookies"; import { copyText } from "@/utils/methods"; import { FC, useRef, useState } from "react"; import "./page.scss"; interface Props {} const App: FC = (props) => { const t = useTranslations("SummaryPage"); const locale = useLocale(); const sliderRef = useRef(null); const [num, setNum] = useState(100); const [money, setMoney] = useState("5000"); const { userInfo } = useUserInfoStore(); const token = getToken(); const shareUrl = `http://192.168.0.84:3000/${locale}/${userInfo ? userInfo.referrer_code : "xxxxxx"}`; const TIME = 180000; const [todayData, setTodayData] = useState({ commissar: 0, effective_amount: 0, recharge_user_count: 0, reg_count: 0, }); const getUserMoneyHandler = () => { if (token) { return getRegisterCountApi(); } return Promise.reject(); }; useRequest(getUserMoneyHandler, { pollingInterval: TIME, pollingWhenHidden: true, pollingErrorRetryCount: 3, staleTime: 5000, refreshDeps: [token], onError: (error) => {}, onSuccess: (res) => { if (res.data) { setTodayData(res.data); } }, }); const [totalData, setTotalData] = useState({ commissar: 0, effective_amount: 0, recharge_user_count: 0, reg_count: 0, }); const getTotalCount = () => { if (token) { return getTotalCountApi(); } return Promise.reject(); }; useRequest(getTotalCount, { pollingInterval: TIME, pollingWhenHidden: true, pollingErrorRetryCount: 3, staleTime: 5000, refreshDeps: [token], onError: (error) => {}, onSuccess: (res) => { if (res.data) { setTotalData(res.data); } }, }); const [commissionData, setCommissionData] = useState({ commissar: 0, level: 0, withdrawal_commissions: 0, }); const getCommission = () => { if (token) { return getCommissionApi(); } return Promise.reject(); }; const { run: commissionRun } = useRequest(getCommission, { pollingInterval: TIME, pollingWhenHidden: true, pollingErrorRetryCount: 3, staleTime: 5000, refreshDeps: [token], onError: (error) => {}, onSuccess: (res) => { if (res.data) { setCommissionData(res.data); } }, }); const handleSlide: any = (e: React.MouseEvent) => { if (sliderRef.current) { const startX = sliderRef.current.getBoundingClientRect().x; const x = e.clientX - startX; const xRem = x / (144 * 0.6); const intNum = Math.round(10000 * xRem) - Math.round((10000 * xRem) % 10); setNum(intNum); const m = intNum * 50; let r = ""; const arr = m.toString().split(""); arr.forEach((item, i) => { if (i !== arr.length - 1 && (arr.length - i - 1) % 3 === 0) { r += item + ","; } else { r += item; } }); setMoney(r); const scale = (Math.round(xRem * 10000) / 100.0).toFixed(2) + "%"; sliderRef.current.style.width = scale; } }; const copy = (text: string) => { copyText(text); Toast.show({ icon: "success", content: t("copySuc"), maskClickable: false }); }; const withdrawalHandler = async () => { await getWithdrawalApi({ amount: 10 }); // 间隔时间 setTimeout(() => { commissionRun(); }, 100); }; // @ts-ignore return (
{t("Hoje")}
  • {todayData.reg_count}

    {t("Inscrições")}

  • {todayData.recharge_user_count}

    {t("Novos")}

  • {t("R$")} {todayData.effective_amount}

    {t("Aposta")}

  • {t("R$")} {todayData.commissar}

    {t("Comissão")}

{t("Total")}
  • {totalData.reg_count}

    {t("Inscrições")}

  • {totalData.recharge_user_count}

    {t("Jogadores")}

  • {t("R$")} {totalData.effective_amount}

    {t("ApostaTotal")}

  • {t("R$")} {totalData.commissar}

    RS {t("Comissão")}

{t("Comissão")}
{commissionData.level}
{t("Nível")}
  • {t("R$")} {commissionData.withdrawal_commissions}

    {t("TotalPago")}

  • {t("R$")} {commissionData.commissar}

    {t("Não")}

{t("TRANSFERIR")}{" "}
{t("Valor")}
{t("title1")}
  • {t("Facebook")}
  • {t("WhatsApp")}
  • {t("Telegram")}
  • {t("Twitter")}
  • {t("Email")}
{t("content1")}
{shareUrl} copy(shareUrl)}> {t("Cópia")}
{t("title2")}
{t("content2-1")}
{t("content2-2")} {t("business")}
{t("title3")}
{t("content3")}
{t("number")} {num}
{t("Comissão")} > {t("R$")} {money} {t("money")}
{t("title4")}
  • {t("content4-1")} {t("red")}.
  • {t("content4-2")}
); }; export default App;